{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "43763fb6",
   "metadata": {},
   "source": [
    "-------\n",
    "* 2022\\9\\5 week03\n",
    "* Python学习记录"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e1a8d000",
   "metadata": {},
   "source": [
    "# 本周学习目标\n",
    "\n",
    "> 1.模块\n",
    "\n",
    "> 2.变量\n",
    "\n",
    "> 3.循环遍历"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "73f0cf79",
   "metadata": {},
   "source": [
    "# 1.1模块（标准库）\n",
    "\n",
    ">python创始人团队为后面使用这门编程语言的人解决日常生活可能用到的功能，而制作的方便用的"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b405ab60",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f35d56a5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662345791.23628"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 纪元（1970.1.1.）\n",
    "# 时间戳\n",
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "38af23fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1662346053.6379519"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.time()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f543acbb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=10, tm_min=47, tm_sec=45, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "fd0a731d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2022, tm_mon=9, tm_mday=5, tm_hour=2, tm_min=48, tm_sec=7, tm_wday=0, tm_yday=248, tm_isdst=0)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.gmtime()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "47156105",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Mon Sep  5 10:53:52 2022'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.asctime(time.localtime())\n",
    "# 格式化时间"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c9458e7d",
   "metadata": {},
   "source": [
    "## 1.2模块（开源模块）\n",
    "\n",
    "> 1.因为代码开源  \n",
    "> 2.集合全领域（全人类）的需求  \n",
    "> 3.按照国际标准开放的模块库   "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "51306a2b",
   "metadata": {},
   "source": [
    "## 1.3模块（自定义模块）\n",
    "> 1.不愿意开源的有一定知识产权的（开放API租用形式开放）  \n",
    "> 2.自己用的，写的也不怎么好，开源出去丢人的。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "27506f3f",
   "metadata": {},
   "source": [
    "## 2.变量\n",
    "\n",
    "> 1.声明变量（明名）规则\n",
    "\n",
    ">> 1. 变量名只能是字母、数字或下划线的任意组合\n",
    "    2.第一个字符不能是数字"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "6fdbd6c8",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01 = \"Xiao Hong\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "fbb8b9b0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Xiao Hong'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三_01"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "ea580143",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2797035854832"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(网三_01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "9e972237",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (2802667665.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Input \u001b[1;32mIn [14]\u001b[1;36m\u001b[0m\n\u001b[1;33m    1网三=\"Xiao Hong\"\u001b[0m\n\u001b[1;37m     ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "1网三=\"Xiao Hong\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "c7924303",
   "metadata": {},
   "outputs": [],
   "source": [
    "网三_01_age=19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "319493c3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "19"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "网三_01_age"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "2635417f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "180000001 180000001\n"
     ]
    }
   ],
   "source": [
    "# 案例（关于变量）\n",
    "\n",
    "网三_01_ID=\"180000001\"\n",
    "\n",
    "网三_02_ID= 网三_01_ID\n",
    "\n",
    "print(网三_01_ID,网三_02_ID)\n",
    "\n",
    "网三_01_ID=\"180000006\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "d74382d8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "180000006 180000001\n"
     ]
    }
   ],
   "source": [
    "print(网三_01_ID,网三_02_ID)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d7f4949d",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(网三_01_name,网三_02_name)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cc2a3944",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 课后作业\n",
    "* 1.课本p4项目练习（写一遍运行成功）\n",
    "* 2.思考if是什么\n",
    "* 3.思考from是什么"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
